<?php
session_start();					// 启用Session
require 'db_connect.php';         // 连接数据库
if (!$_SESSION["username"]) {		// 判断是否处于成功登录状态
    header("Location: login.php");	// 跳转到登录页面
    exit();							// 终止后续代码的执行
}
?>
<html>
<head>
    <meta charset="utf-8"/>
    <title>修改邮箱</title>
    <link rel="stylesheet" href="css/style.css"/>
</head>
<body onload="body_onload_handler()">
<div class="card-container">
    <form action="changeMailImpl.php" method="POST" id="login-form">
        <div id="login-title"><h3>修改邮箱</h3> </div>
        <div class="input-group" id="origin">
            <input type="text" name="origin"
                   placeholder="原邮箱为：<?php echo $_SESSION['mail']?>" readonly>
        </div>
        <div class="input-group" id="afterChange">
            <input type="password" name="mail"
                   placeholder="修改后的邮箱" required>
        </div>
        <div class="input-group" id="captcha-input">
            <input type="text" name="code" placeholder="请输入验证码">
        </div>
        <div class="input-group" id="captcha-img">
            <?php
            $_SESSION["code"] = rand()%10;
            ?>
            <img src="img/code_<?=$_SESSION["code"]?>.png">

        </div>
        <p id="captcha-info">验证码只包含字母,不区分大小写</p>
        <div class="alert" id="login-alert"></div>
        <div class="form-group">
            <button class="button" id="login-submit" type="submit"><span>确认修改</span></button>
        </div>
    </form>
</div>
</body>
</html>
